package com.ymatou.iapi.coupon.service;

import com.ymatou.iapi.coupon.parameter.BestGetProductUsableBatchs;
import com.ymatou.iapi.coupon.parameter.SellerCouponsList;
import com.ymatou.iapi.coupon.parameter.batchInfos;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.DataUtil;
import com.ymttest.utils.EnvSetup;
/**
*全球优选--获取商品可用可领的优惠券批次idCall
*FreeMaker Template自动生成代码
*/
public class getProductUsableBatchesCall extends YmatouBaseCall{
	private static String opurl ="api/best/getProductUsableBatches";
	
	public getProductUsableBatchesCall() {
		super(EnvSetup.getSystemUrl("couponiapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	
	  public String getStatusCode1()
	    {
	        return getString("statusCode");
	    }

	    public String getMessage()
	    {
	        return getString("message");
	    }

	    public String getData()
	    {
	        return getString("data");
	    }

	    public BestGetProductUsableBatchs getUsableBatchDtos()
	    {
	    	BestGetProductUsableBatchs data = null;
	        try {
//	            data =
//	                    (BestGetProductUsableBatchs) FormatUtil.GSONToObject(
//	                    		DataUtil.Json.parseJsonObj(getData()).get("usableBatchDtos").toString(), BestGetProductUsableBatchs.class);
	            data =
	                    (BestGetProductUsableBatchs) FormatUtil.GSONToObject(getData(),BestGetProductUsableBatchs.class);
	        } catch (Exception e) {
	            e.printStackTrace();
	        }
	        return data;
	    }
}